<?php

/**
 * @category   Ac
 * @package    Application_Model
 * @copyright  Orient Network Ltd
 * @license    Closed
 * @author     SARDS
 */
class Model_Feed extends Ac_Model
{

	protected static  $_collection = 'feed';
	
	protected static $_transcript = array(
        '_id'	=> '_id',
        'pn'	=> 'provider_name',
        'pid'	=> 'provider_id',
        'uid'	=> 'user_id',
        's_dt'	=> 'start_date',
        'e_dt'	=> 'end_date',
        'sc'	=> 'scraped_count',
        'ic'	=> 'imported_count',
        'dc'	=> 'deleted_count',
        'pc'	=> 'published_count',
        'dur'	=> 'duration',
        'sa'	=> 'status',
        'rm'	=> 'remarks'
	);
	
	public function __construct($data = array(), $config = array())
	{
        $config['collection'] = 'feed';
         parent::__construct($data, $config);
    }
	
	public function preSave() {
 
        if (empty($this->s_dt)) {
            $this->s_dt = new MongoDate(time());
        } elseif (!$this->s_dt instanceof MongoDate) {
            $this->s_dt = new MongoDate($this->s_dt);
        } elseif ($this->s_dt->sec < 0) {
            $this->s_dt = new MongoDate(time());
        }
	}
	
	public function postSave() {
	
	}
	
}


?>